<?php
class cate extends base{

	public function init(){ // 公用
		parent::init(); // 这是必须的

		$this->tit = '分类';
		$this->modelObj = D('sys_cate');

		$this->data_list = $this->modelObj->get_treeList("status=1");
	}

	//列表
	public function index(){
		$this->tabtit = array('全部','禁用');

		$cond = "1=1";
		//加入查询条件
		switch($this->tab){
			case '1':
				$cond .=" and status=0";
				break;
			default:
				$cond .=" and status=1";
		}
		//搜索
		if($this->keyword){
			$cond.=" and (name like '%".$this->keyword."%') ";
		}
		$this->list = $this->modelObj->get_treeList($cond,'id asc');
		if($this->tab != 0){
			$this->list = $this->modelObj->findAll(array($cond));
		}

	}


}